//
//  TBRNewNoticeListC.m
//  TBText
//
//  Created by yy on 2018/4/29.
//  Copyright © 2018年 yy. All rights reserved.
//

#import "TBRNewNoticeListC.h"
#import "TBRNoticeListCell.h"
#import "TBRMineModel.h"
#import <YYModel.h>
@interface TBRNewNoticeListC ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView      *tableView;
@property (nonatomic,strong)NSMutableArray *dataArray;

@end

@implementation TBRNewNoticeListC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setupUI];
    
    //加载数据
    [self loadData];
}

- (void)setupUI {
    //设置导航条
    [self setupNavItem];
    
    //添加tableView
    [self setupTableView];
}

- (void)setupNavItem {
    self.titleText = @"消息";
}

- (void)setupTableView {
    self.tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
    [self.view addSubview:self.tableView];
    [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.trailing.top.bottom.offset(0);
    }];
    self.tableView.delegate = self;
    self.tableView.dataSource = self;
    self.tableView.tableFooterView = [UIView new];
    [self.tableView registerNib:[UINib nibWithNibName:@"TBRNoticeListCell" bundle:nil] forCellReuseIdentifier:@"TBRNoticeListCellId"];
    if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) {
        [self.tableView setSeparatorInset:UIEdgeInsetsMake(0, -45, 0, 0)];
    }
    self.tableView.showsVerticalScrollIndicator = NO;
}

#pragma mark - 返回组
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

#pragma mark - 返回行
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 10;
}

#pragma mark - 返回每行内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    //自定义cell
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:[self getIdentifier:indexPath] forIndexPath:indexPath];
    [self setupCell:cell indexPath:indexPath];
    return cell;
}

- (NSString *)getIdentifier:(NSIndexPath *)indexPath {
    NSString *iden = @"TBRNoticeListCellId";
//    if (indexPath.section == 0 && indexPath.row == 0) {
//        iden = @"TBRMineSettingIconCellId";
//    }else {
//        iden = @"TBRMineSettingBasicCellId";
//    }
    return iden;
}

- (void)setupCell:(UITableViewCell *)cell indexPath:(NSIndexPath *)indexPath {
    
    TBRNoticeListCell *noticeListCell = (TBRNoticeListCell *)cell;
//    NSArray *tmpArray = self.dataArray[indexPath.section];
//    TBRMineInfoBasicModel *basicModel = tmpArray[indexPath.row];
    
//    infoBasicCell.basicModel = basicModel;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 90;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}


// MARK: - 加载数据
- (void)loadData {
    [self loadLocalData];
    [self loadNetData];
}
// MARK: - 本地数据
- (void)loadLocalData {
    self.dataArray = [NSMutableArray array];
    NSArray *tmpArray = @[
                          @[@{@"messageId":@"userName",@"imageName":@"",@"titleName":@"用户名",
                              @"detailName":@"丁晓龙"},@{@"messageId":@"userName",@"imageName":@"",@"titleName":@"用户名",@"detailName":@"丁晓龙"}],
                          @[@{@"messageId":@"phoneNum",@"imageName":@"",@"titleName":@"手机",@"detailName":@"13373633086"}],
                          @[@{@"messageId":@"password",@"imageName":@"",@"titleName":@"登录密码",@"detailName":@"未设置"},
                            @{@"messageId":@"payType",@"imageName":@"",@"titleName":@"支付方式",@"detailName":@"我的客服"},]
                          ];
    
    for (NSArray *tmpEnumArray in tmpArray) {
        NSArray *tmpModelArray = [NSArray yy_modelArrayWithClass:[TBRMineInfoBasicModel class] json:tmpEnumArray];
        [self.dataArray addObject:tmpModelArray];
    }
    
}

// MARK: - 获取网络数据-----
- (void)loadNetData {
    
}
@end
